import bot from "./model/bot/amesu";
import { fontMap } from "./model/gm/Lable";
// import Node from "./model/gm/Node";
import { BOT_MSG_AT } from "./model/bot/botType";
import server from "./model/client/server";
import { loadModules } from "./model/msgHandle/packge_tool";
import { join } from "path";
import browser from "./model/browser/browser";
import func from "./model/func";

async function main(this: any) {
    func.pngDir = '127.0.0.1'
    browser._init()
    // let url = `https://bot.nfiii.cn/1711122784546.png`;
    // let a = `https://${func.pngDir}/${url.replace(/^\.\/html\/public\//, '')}`;
    // debugger;
    // bot.setBotConfig({
    //     appid: '102005633',
    //     token: 'oWRHruioytIBhqLXIEoIfgLjGL6c3FHG',
    //     events: [
    //         'PUBLIC_GUILD_MESSAGES',
    //         // 'GUILD_MESSAGE_REACTIONS'
    //     ],
    //     secret: 'iQ8qYH0jSBueO8scM7sdO9ugSE0mYK7u',
    //     sandbox: false,
    //     log_level: 'INFO',
    // })
    // bot.setBotConfig({
    //     appid: '102093813',
    //     token: '7AieWa5fdC0ezHxIgzBIhNDhW4nVvVx9',
    //     events: [
    //         'PUBLIC_GUILD_MESSAGES',
    //         'GROUP_MESSAGES',
    //         // 'GUILD_MESSAGE_REACTIONS'
    //     ],
    //     secret: 'UyTyTyTyTzV1X3Z5b8fCjGnKsQyW4cAj',
    //     sandbox: true,
    //     log_level: 'INFO',
    // })
    bot.setBotConfig({
        appid: '102005633',
        token: 'oWRHruioytIBhqLXIEoIfgLjGL6c3FHG',
        events: [
            'PUBLIC_GUILD_MESSAGES',
            // 'GROUP_MESSAGES',
            // 'GUILD_MESSAGE_REACTIONS'
        ],
        secret: 'O0cErU7kN0dHvZDrV9nS7mR6lQ6mS8oU',
        sandbox: false,
        log_level: 'INFO',
    })

    // 连接服务器
    await server.setWsUrl('ws://127.0.0.1:8848');
    func.server = '43.136.14.72'
    // await server.setWsUrl(`ws://${func.server}:8848`);
    // 初始化游戏
    const loadDir = join(__dirname, "packge");
    loadModules(loadDir);
}

main();